import { IState, ITodo } from "@/typing";
import { Commit } from "vuex";

interface ICtx {
    commit: Commit,
    state: IState,
}
const SET_TODO: string = 'SET_TODO';
const SET_TODO_LIST: string = 'SET_TODO_LIST';
const REMOVE_TODO: string = 'REMOVE_TODO';
const SET_TODO_STATUS: string = 'SET_TODO_STATUS';
const SET_DOING_STATUS: string = 'SET_TODO_DOING';
export default{
    [SET_TODO]({commit}: ICtx , todo: ITodo): void{
      commit(SET_TODO,todo);
    },
    [SET_TODO_LIST]({commit}: ICtx ,todoList: ITodo[]): void{
        commit(SET_TODO_LIST,todoList);
    },
    [REMOVE_TODO]({commit}: ICtx ,id: number): void{
        commit(REMOVE_TODO,id);
    },
    [SET_TODO_STATUS]({commit}: ICtx ,id: number): void{
        commit(SET_TODO_STATUS,id);
    },
    [SET_DOING_STATUS]({commit}: ICtx ,id: number): void{
        commit(SET_DOING_STATUS,id);
    }
}